package top.anka1.fxgui;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

import java.io.IOException;
/**
 * JavaFX application for a restaurant management system.
 * This class serves as the entry point for the application.
 * It initializes the main stage and loads the FXML layout.
 * @author Anka
 */
public class RestaurantApplication extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader(RestaurantApplication.class.getResource("restaurant-view.fxml"));
        Scene scene = new Scene(fxmlLoader.load());
        RestaurantController restaurantController = fxmlLoader.getController();
        restaurantController.setStage(primaryStage);
        primaryStage.setOnCloseRequest((WindowEvent event) -> {
            event.consume();
            restaurantController.exitRestaurant();
        });
        primaryStage.setTitle("Restaurant Management System");
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}
